package com.nbsaas.boot.room.rest.convert;

import com.nbsaas.boot.room.data.entity.Room;
import com.nbsaas.boot.room.api.domain.response.RoomResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* 实体对象转化成响应对象
*/

public class RoomResponseConvert  implements Converter<RoomResponse,Room> {

    @Override
    public RoomResponse convert(Room source) {
        RoomResponse  result = new  RoomResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getShop()!=null){
                        result.setShop(source.getShop().getId());
                    }
                    if(source.getShop()!=null){
                        result.setShopName(source.getShop().getName());
                    }
        return result;
    }

}

